package com._21cn.cms.resource.dao.mybatis;

import com._21cn.cms.resource.dao.PictureDao;
import com._21cn.cms.resource.entity.Picture;
import com._21cn.framework.base.db.mybatis.BaseDaoMybatis;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.stereotype.Repository;

@Repository("pictureDao")
public class PictureDaoMybatis extends BaseDaoMybatis<Picture> implements PictureDao {

    public PictureDaoMybatis() {
        super();
        setNameSpace( "t_cms_picture" );
    }

    @Required
    @Autowired
    @Qualifier("sqlSessionFactory")
    public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
        super.setSqlSessionFactory( sqlSessionFactory );
    }

    @Override
    public Picture selectByHashcode(String hashcode) {
        return (Picture) getSqlSession().selectOne(getNameSpace() + ".selectByHashcode", hashcode);
    }

}